#include "server.hpp"

void test1()
{
      Buffer buf;
      std::string s("hello\n");
      buf.WriteStringAndPush(s);

      uint64_t sz=buf.ReadAbleSize();
      std::cout<<"read len:"<<sz<<std::endl;
      //std::string ret=buf.ReadAsStringPop(sz);
      //std::cout<<ret;

      Buffer buf1;
      buf1.WriteBufferAndPush(buf);
      uint64_t sz1=buf1.ReadAbleSize();
      std::cout<<"read len:"<<sz1<<std::endl;
      //std::string ret1=buf1.ReadAsStringPop(sz);
      //std::cout<<ret1;
}

void test2()
{
      Buffer buf;
      for(int i=0;i<10;i++)
      {
            std::string s="hello:"+std::to_string(i)+'\n';
            buf.WriteStringAndPush(s);
      }
      for(int i=0;i<10;i++)
      {
            std::string s=buf.GetLineAndPop();
            std::cout<<s;
      }
}

int main()
{
      test2();
      return 0;
}